<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><spring:message code="create_fashion_style"/></title>
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
	<link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
	<link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
	<script src="${ctxStatic}/layDate/laydate.js"></script>
	<c:set value="customizationUnitCost" var="customUnit"/>
	<c:set value="orderList" var="orderImage"/>
	<script type="text/javascript">
        $(document).ready(function() {
        	$("#urgentCD").select2();
            $("#orderStatusUS").select2();
        });
        
        function saveStatus() {
        	ShowDiv();
        	var targetDateStr = $("#targetDateStr").val();
        	var urgentCD = $("#urgentCD").find("option:selected").val();
        	var orderStatusUS = $("#orderStatusUS").find("option:selected").val();
        	if (targetDateStr==""&&urgentCD==""&&orderStatusUS=="") {
        		alert("至少选填一项！");
				return;
			}
        	var beginDate = $("#beginDate").val();
        	var contractNo = $("#contractNo").val();
        	var orderNO = $("#orderNO").val();
        	var shirtSgd = $("#shirtSgd").val();
        	var orderStatusCD = $("#orderStatusCD").val();
        	var styleNoFrom = $("#styleNoFrom").val();
        	var styleNoTo = $("#styleNoTo").val();
        	var url = "?beginDate="+beginDate+"&contractNo="+contractNo+"&orderNO="+orderNO+"&shirtSgd="+shirtSgd+"&orderStatusCD="+orderStatusCD+"&styleNoFrom="+styleNoFrom+"&styleNoTo="+styleNoTo
        			+"&targetDateStr="+targetDateStr+"&urgentCD="+urgentCD+"&orderStatusUS="+orderStatusUS;
            $.post("${ctx}/customization/order/saveStatus"+url,"",function (result) {
				if(result == "true"){
					tipParent("更新成功");
				}else if(result == "cloud"){
					tipParent("订单数为0,更新失败");
				}else{
					tipParent("更新失败!");
				}
				window.parent.frames[0].searchListForm();
				closeWin();
				HiddenDiv();
            });
		}
        
        //显示加载数据
        function ShowDiv() {
            $("#loading").show();
        }

        //隐藏加载数据
        function HiddenDiv() {
            $("#loading").hide();
        }
    </script>
</head>
<body>
<form id="inputForm"  method="post">
<input type="hidden" id="beginDate" value="${order.beginDate }"/>
<input type="hidden" id="contractNo" value="${order.contractNo }"/>
<input type="hidden" id="orderNO" value="${order.orderNO }"/>
<input type="hidden" id="shirtSgd" value="${order.shirtSgd }"/>
<input type="hidden" id="orderStatusCD" value="${order.orderStatusCD }"/>
<input type="hidden" id="styleNoFrom" value="${order.styleNoFrom }"/>
<input type="hidden" id="styleNoTo" value="${order.styleNoTo }"/>
<div class="tabBoxSm">
     <div class="tabSm smOrderBox" style="width:500px">
        <div class="items clearfix">
            <div class="col-50 clearfix">
                    <!-- 样板文件上传画面 -->
                     <strong style="font-size:15px;">更新状态</strong>
            </div>
            <div class="col-50 clearfix" >
            <div style="float:right;">
            	<!-- 保存 -->
               <button type="button" class="btn-js" onclick="saveStatus()"><spring:message code="common_save"/></button>
               <!-- 关闭 -->
               <button type="button" class="btn-js" onclick="closeWin()"><spring:message code="btn_cancle"/></button>
               </div>
            </div>
            <br><hr></hr>
        </div>
        <c:set value="ORDER_STATUS" var="orderStatusList"/>
        <c:set value="ORDER_FLAG" var="orderFlagList"/>
        <div class="items clearfix">
        <p class="tit" style="width: 60px;">订单标记</p>
        <select id="urgentCD" name="urgentCD" style="width: 200px;">
        <option value="">请选择</option>
        <c:forEach items="${fns:getDictList(orderFlagList) }" var="oflist">
        	<option value="${oflist.itemCode }-${oflist.itemValue }">${oflist.itemNameCn }</option>
        </c:forEach>
        </select>
         </div>
         <div class="items clearfix">
        <p class="tit" style="width: 60px;">订单状态</p>
        <select id="orderStatusUS" name="orderStatusUS" style="width: 200px;">
        <option value="">请选择</option>
        <c:forEach items="${fns:getDictList(orderStatusList) }" var="oslist">
        	<option value="${oslist.itemCode }-${oslist.itemValue }">${oslist.itemNameCn }</option>
        </c:forEach>
        </select>
         </div>
         <div class="items clearfix">
        <p class="tit" style="width: 60px;">交货日期</p>
        <div class="timeBox">
							<input type="text" class="laydate-icon" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})"
								id="targetDateStr" name="targetDateStr" style="width: 200px" value=""></div>
         </div>
         <div class="items clearfix">
             <strong><font color="#FF0000">注意：<br>保存更新状态前请确保已添加检索条件。<br>保存后会更改所有检索出的订单，请谨慎！</font></strong>
         </div>
     </div>
</div>
</form>
</body>
</html>
